package org.edu.modules.sxjy.controller;

import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.edu.common.api.vo.Result;
import org.edu.common.aspect.annotation.AutoLog;
import org.edu.common.system.base.controller.BaseController;
import org.edu.modules.sxjy.entity.VeBaseTeacher;
import org.edu.modules.sxjy.entity.VeClassTeacher;
import org.edu.modules.sxjy.entity.VeCommon;
import org.edu.modules.sxjy.service.IVeClassTeacharService;
import org.edu.modules.sxjy.utils.PageResponseResult;
import org.edu.modules.sxjy.vo.VeClassTeacharVo;
import org.edu.modules.sxjy.vo.VeTeacherVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(tags={"实习指导老师安排表"})
@RestController
@RequestMapping({"/sxjy/veClassTeachar"})
@Component
@ApiSort(60)
public class VeClassTeacherController
        extends BaseController<VeClassTeacher, IVeClassTeacharService>
{
    private static final Logger log = LoggerFactory.getLogger(VeClassTeacherController.class);
    @Autowired
    private IVeClassTeacharService veClassTeacharService;

    @AutoLog("实习指导老师安排表-查询列表")
    @ApiOperation(value="查询列表", notes="实习指导老师安排表-查询列表")
    @GetMapping({"/selectAll"})
    public PageResponseResult selectAll(VeClassTeacharVo veClassTeacharVo, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, VeCommon veCommon)
    {
        return this.veClassTeacharService.selectAll(veClassTeacharVo, pageNo, pageSize, veCommon);
    }

    @AutoLog("实习指导老师安排表-回显指导教师")
    @ApiOperation(value="回显指导教师", notes="实习指导老师安排表-回显指导教师")
    @GetMapping({"/echoFaculty"})
    public Result<?> echoFaculty(VeClassTeacher veClassTeacher)
    {
        if (veClassTeacher != null)
        {
            List<VeBaseTeacher> veTeacher = this.veClassTeacharService.echoFaculty(veClassTeacher);
            return Result.OK(veTeacher);
        }
        return Result.error("暂无教师");
    }

    @AutoLog("实习指导老师安排表-设置指导教师")
    @ApiOperation(value="设置指导教师", notes="实习指导老师安排表-设置指导教师")
    @PutMapping({"/setFaculty"})
    public Result<?> setFaculty(@RequestBody List<VeTeacherVo> veTeacherVoList)
    {
        if (veTeacherVoList.size() > 0)
        {
            this.veClassTeacharService.setFaculty(veTeacherVoList);
            return Result.OK("设置成功");
        }
        return Result.error("设置失败");
    }
}
